import world
import inventory
import stranded
import flags

current_game = stranded
run = True
prompt_needs_draw = True
def prompt():
   print ''
   print '=' * 30
   print world.get_current_room()   .desc
   print '-' * 30
   for e in world.get_current_room().exits:
      print e
   prompt_needs_draw = False
   
def parse(cmd):
   c = cmd.split(' ')
   if c[0] == 'move':
      prompt_needs_draw = True
      try:
         move_func = getattr(world.get_current_room(), 'move_' + c[1])
         move_func(world.get_current_room().exits[c[1]])
      except:
         print "Can't seem to move that direction."
   elif c[0] == 'inspect':
      try:
         ins_func = getattr(world.get_current_room(), 'inspect_' + c[1])
         ins_func()
      except:
         print "I don't see that around here."
   elif c[0] == 'exit':
      exit()
   elif c[0] == 'debug':
      d = dir(world.get_current_room())
      for i in d:
         print i
      for f in flags.flags:
         print f
   else:
      prompt_needs_draw = True
      print "What? I have no idea what you want me to do!"

stranded.populate()
world.init()

print current_game.INTRO


while run:
   print prompt_needs_draw
   if prompt_needs_draw:
      prompt()
   cmd = raw_input('>')
   parse(cmd)